<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'main.jsp' starting page</title>
<link href="<%= basePath %>/manager/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%= basePath %>/common/js/jQuery-1.9.1.js"></script>
<script type="text/javascript">
	
	/* 
	
	删除多个
	var idStr;
	$(function(){

		$(":checkbox").click(function(){
			$(this).attr("checked","checked");
		});
		
	});
	
	function selectAllChecked() {
	
		var checkedAll = $("#checkedAll").attr("checked");
		if(checkedAll =="checked"){
			$(":checkbox").removeAttr("checked");
		}else if(checkedAll == undefined){
			$(":checkbox").attr("checked", "checked");
		}
	}
	

	function deleteChecked() {

		idStr ="";
		var domList = $(":checkbox");
		for ( var i = 0; i < domList.length; i++) {
			if (getValue(domList[i]) != null) {
				idStr += getValue(domList[i]);
				if (i != domList.length - 1) {
					idStr += ",";
				}
			}
		}
		
		if (0 == idStr.length) {
			alert("请选中一条记录后再点击删除.");
			return;
		}
		$(".tip").fadeIn(200);
	} 
	
	function getValue(box) {

		if ($(box).attr("checked") == "checked" && $(box).val() != "on") {
			if ($(box).val() != null && $(box).val() != "")
				return $(box).val();
		} else {
			return null;
		}
	}
	*/
	
</script>

</head>

<s:action name="findByPager" namespace="/manager_permissionmenu" />

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="javascript:void(0)">首页</a></li>
			<li><a>菜单管理</a></li>
			<li><a>角色菜单列表</a></li>
		</ul>
	</div>

	<div class="rightinfo">

		<table class="tablelist">
			<thead>
				<tr>
					<th>编号<i class="sort"><img src="<%= basePath %>/manager/images/px.gif" /></i></th>
					<th>名称</th>
					<th>显示名</th>
					<th>namespace</th>
					<th>作用范围</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${pager.datas}" var="pm" varStatus="i">
					<tr>
						<td>${i.index+1}</td>
						<td>${pm.pmName}</td>
						<td>${pm.pmShowName}</td>
						<td>${pm.pmNamespace }</td>
						<td>${pm.pmMangerOrplatform == 0 ? "前端":"后端"}</td>
						<td>${pm.pmStatus == 0 ? "正常" : "禁用" }</td>
						<td>
							<a href="javascript:location.href = 'manager_permissionmenu/input?id=${pm.pmId}'" class="tablelink">修改</a>
							<%-- 删除需谨慎 --%>
							<%-- <a href="javascript:$('.tip').fadeIn(200);$('#deleteSubmit').attr('name',${pm.pmId});" class="tablelink">删除</a>  --%>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>


		<pg:pager url="manager/permissionMenu/list.jsp" items="${pager.total}" export="currentPageNumber=pageNumber" maxPageItems="10"
			maxIndexPages="10">

			<div class="pagin">
				<div class="message">
					共<i class="blue">${pager.total}</i>条记录，当前显示第&nbsp;<i class="blue">${currentPageNumber}&nbsp;</i>页
				</div>
				<ul class="paginList">
					<li class="paginItem">
						<pg:prev>
							<a href="${pageUrl}"><span class="pagepre"></span></a>
						</pg:prev>
					</li>
					<pg:pages>
						<c:choose>
							<c:when test="${currentPageNumber eq pageNumber}">
								<li class="paginItem"><a style="color: red">${pageNumber}</a></li>
							</c:when>
							<c:otherwise>
								<li class="paginItem"><a href="${pageUrl }">${pageNumber}</a></li>
							</c:otherwise>
						</c:choose>
					</pg:pages>
					<li class="paginItem">
						<pg:next>
							<a href="${pageUrl}"><span class="pagenxt"></span></a>
						</pg:next>
					</li>
				</ul>
			</div>
		</pg:pager>

		<div class="tip">
			<div class="tiptop">
				<span>提示信息</span><a></a>
			</div>

			<div class="tipinfo">
				<span><img src="<%= basePath %>/manager/images/ticon.png" /></span>
				<div class="tipright">
					<p>确认对删除信息？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>

			<div class="tipbtn">
				<input onclick="javascript:location.href = 'manager_permissionmenu/delete?id='+$(this).attr('name')" type="button" class="sure" value="确定" name="" id="deleteSubmit" />&nbsp; 
				<input onclick="javascript:$('.tip').fadeOut(200);" type="button" class="cancel" value="取消" />
			</div>

		</div>
	</div>
</body>
</html>